package com.qfedu.openplateform.manager.controller;

import com.github.pagehelper.PageInfo;
import com.qfedu.openplateform.manager.entity.AjaxMessage;
import com.qfedu.openplateform.manager.entity.TableData;
import com.qfedu.openplateform.manager.entity.UserToken;
import com.qfedu.openplateform.manager.service.UserTokenService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * TODO
 *
 * @author DELL
 * @date 2021-10-27 19:43
 */

@RestController
@RequestMapping("/sys/token")
public class UserTokenController {

    @Resource
    private UserTokenService userTokenService;



    @RequestMapping("/table")
    public TableData table(UserToken userToken, Integer page, Integer limit){

        PageInfo<UserToken> table = userTokenService.table(userToken, page, limit);


        return new TableData(table.getTotal(),table.getList());

    }

    @RequestMapping("/del")
    public AjaxMessage deleteToken(int[] ids){
        if (ids!=null) {
            userTokenService.deleteToken(ids);
            return new AjaxMessage(true, "删除成功");
        }else {
            return new AjaxMessage(false,"没有删除的目标");
        }
    }





}
